import uni from "@dcloudio/vite-plugin-uni"
import AutoImport from 'unplugin-auto-import/vite'
import { defineConfig, loadEnv } from "vite"

import { resolve } from "path"

const config = loadEnv("development", "./")

export default defineConfig({
  plugins: [
    uni(),
    AutoImport({
      imports: ['vue'],
      dts: 'types/auto-imports.d.ts',
    }),
  ],
  server: {
    host: '0.0.0.0',
    port: 3000,
    base: config.VITE_APP_BASE_PATH,
    proxy: {
      '^/api': {
        target: 'http://xuanxiaoqian.com:9876',
        changeOrigin: true,
        rewrite: (path) => path.replace('/api', ''),
      },
    },
  },
  resolve: {
    alias: {
      "@": resolve(__dirname, "./src"),
    },
  },
});

